import request from '@/utils/request'
export function getAllDevices(data:any) {
    return request({
      url: '/device/list',
      method: 'post',
      data
    });
  }
  
  // 获取员工分配的设备（带分页）
  export function getDevicesByEmployee(data:any) {
    return request({
      url: '/device/employee',
      method: 'post',
      data
    });
  }
  // 获取员工列表
export function getEmployeeList() {
    return request({
      url: '/employee/littleList',
      method: 'get'
    });
  }
  
  // 分配设备
  export function allocateDevice(data:any) {
    return request({
      url: '/device/allocate',
      method: 'put',
      data
    });
  }
  
  // 更新设备状态
  export function updateDeviceStatus(data:any) {
    return request({
      url: '/device/updateStatus',
      method: 'put',
      data
    });
  }
  
  // 添加设备
  export function addDevice(data:any) {
    return request({
      url: '/device/add',
      method: 'post',
      data
    });
  }

  export function reportDeviceIssue(data:any) {
    return request({
      url: '/device/report',
      method: 'post',
      data
    });
  }

  export function deviceWarning(data:any) {
    return request({
      url: '/device/warning',
      method: 'post',
      data
    });
  }
  export function submitInspection(data:any){
    return request({
      url: '/device/inspection',
      method: 'post',
      data,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    });
  }
 
  export function downloadDeviceTemplate() {
    return request({
      url: '/device/template',
      method: 'get',
      responseType: 'blob',
      transformResponse: [(data) => data]
    });
  }
  export function importDevices(data:any){
    return request({
      url: '/device/import',
      method: 'post',
      data,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    });
  }